<template>
    <div class="container">
        <div class="containerEart">
            <p class="dialogTitle">房屋地震灾害风险评估</p>
            <div class="header">
                <div class="icon">
                    <svg-icon class-name="error-icon" icon-class="error" style="margin-right:10px" v-if="showIcon" />
                    <span>{{ titleOption }}</span>
                </div>
            </div>
        </div>
        <el-row :gutter="30">
            <el-col :span="21">
                <p style="margin: 10px 0;"><span
                        @click="handleDownloadPort({ attachId: fileNoticeId, attachName: fileNoticeName })"
                        style="cursor: pointer;color:#107ce5">{{
                            fileNoticeName }}</span></p>
            </el-col>
            <el-col :span="3">
                <p style="color:#107ce5;margin: 10px 0;">
                    <reportResult type="3"></reportResult>
                </p>
            </el-col>
        </el-row>

        <div class="tabsBox">
            <el-row :gutter="10" class="button" v-if="!isEnd">
                <el-col :span="1.5">
                    <el-button type="primary" @click="handleAssess">
                        <svg-icon class-name="assess-icon" icon-class="assess" /><span style="margin-left:10px">算法评估</span>
                    </el-button>
                </el-col>
                <el-col :span="1.5" v-if="activeName == 'first'">
                    <el-button type="primary" @click="openUpload">
                        <svg-icon class-name="upload-icon" icon-class="upload" /><span style="margin-left:10px">成果上传</span>
                    </el-button>
                </el-col>
                <!-- <el-col :span="1.5">
                    <span style="color: #107ce5;cursor: pointer;display: inline-block;height: 32px;line-height: 32px;" @click="confirmAnalyze">地震灾害风险隐患点评估</span>
                </el-col> -->
                <!-- <el-col :span="1.5">
                <el-button type="primary" @click="handleDownload">
                    <svg-icon class-name="download-icon" icon-class="download" /><span
                        style="margin-left:10px">批量下载</span>
                </el-button>
            </el-col> -->
                <!-- <el-col :span="1.5" v-if="activeName == 'second'">
                    <el-button type="primary" @click="handleSubmit" :disabled="multiple">
                        <svg-icon class-name="submit-icon" icon-class="submit" /><span style="margin-left:10px">提交</span>
                    </el-button>
                </el-col> -->
            </el-row>
            <el-tabs v-model="activeName" type="card" class="tab" @tab-click="handleClick">
                <el-tab-pane label="中间成果" name="first">
                    <el-table v-loading="loading" :data="dataList" stripe @selection-change="handleSelectionChange">
                        <el-table-column type="selection" width="55" align="center" />
                        <el-table-column label="标题" align="center" prop="sdaAssFileTitel" />
                        <el-table-column label="评估内容" align="center" prop="sdaAssSeiIntensity" />
                        <el-table-column label="生成时间" align="center" prop="sdaAssDate" />
                        <el-table-column label="业务人员" align="center" prop="sdaAssPeople" />
                        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                            <template #default="scope">
                                <el-button type="text" @click="handleDetil(scope.row)">查看</el-button>
                                <el-button type="text" @click="handleEndResult(scope.row)" v-if="!isEnd">提交</el-button>
                                <el-button type="text" @click="handledel(scope.row)" v-if="!isEnd">删除</el-button>
                                <el-button type="text" @click="handleDownload(scope.row)">下载</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-tab-pane>
                <el-tab-pane label="最终成果" name="second" class="two">
                    <el-table v-loading="loading" :data="dataLists" border @selection-change="handleSelectionChange"
                        :span-method="objectSpanMethod">
                        <el-table-column type="selection" width="55" align="center" prop="sdaAssSeiIntensity" />
                        <el-table-column label="评估内容" align="center" prop="sdaAssSeiIntensity" />
                        <el-table-column label="标题" align="center" prop="sdaAssFileTitel" />
                        <el-table-column label="生成时间" align="center" prop="sdaAssDate" />
                        <!-- <el-table-column label="提交时间" align="center" prop="submitTime">
                            <template #default="scope">
                                <span v-if="scope.row.mark == '2'">{{ scope.row.submitTime }}</span>
                                <span v-else></span>
                            </template>
                        </el-table-column> -->
                        <el-table-column label="业务人员" align="center" prop="sdaAssPeople" />
                        <!-- <el-table-column label="提交状态" align="center" prop="mark">
                            <template #default="scope">
                                <span v-if="scope.row.mark == '2'">已提交</span>
                                <span v-else>未提交</span>
                            </template>
                        </el-table-column> -->
                        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                            <template #default="scope">
                                <el-button type="text" @click="handleDetil(scope.row)">查看</el-button>
                                <el-button type="text" @click="handleRemove(scope.row)" v-if="!isEnd">移除</el-button>
                                <el-button type="text" @click="handleDownload(scope.row)">下载</el-button>
                            </template>
                        </el-table-column>
                        <!-- <el-table-column label="描述" align="center" prop="sdaAssSeiIntensity">
                            <template #default="scope">
                                <el-button type="text" @click="addOpenDescribe(scope.row)">编辑描述</el-button>
                            </template>
                        </el-table-column> -->
                    </el-table>
                </el-tab-pane>
            </el-tabs>
        </div>
        <div>
            <p style="font-size: 16px;font-weight: bold;">地震危险性评估功能说明</p>
            <ul class="ulList">
                <li>【算法评估】：采用公式，输入参数，可得出房屋地震灾害风险指标。</li>
                <li>【成果上传】：从本地上传成果至系统中。</li>
                <li>&lt;中间成果&gt;存放通过计算或本地上传的所有成果。</li>
                <li>&lt;最终成果&gt;存放最终放入报告中的成果，报告以&lt;最终成果&gt;的内容为准进行生成。</li>
                <li>所有评估完成后，需返回评估任务界面通过【报告管理】进行报告生成、上传提交等操作。</li>
            </ul>
        </div>

        <el-dialog title="评估结果分析及建议" v-if="openSuggestion" v-model="openSuggestion" width="1000px" append-to-body>
            <p class="mt15"></p>
            <div class="suggesBox">
                <div class="leftBox">
                    <h2 style="text-align: center;">严重破坏和毁坏风险占比统计</h2>
                    <div style="height:180px;padding: 40px;display: flex;align-items: center;justify-content: center;">
                        <Chart :numObj="numObj"></Chart>
                    </div>
                    <el-divider border-style="dashed"></el-divider>
                    <el-table :data="dataList1" row-key="sdaId" style="width: 643px">
                        <el-table-column label="序号" type="index" width="55" align="center">
                          <template #default="scope">
                            <span>{{(formData1.page - 1) * formData1.rows + scope.$index + 1}}</span>
                          </template>
                        </el-table-column>
                        <el-table-column label="建筑名称" align="center" prop="jzmc" width="180" show-overflow-tooltip/>
                        <el-table-column label="经度" align="center" prop="longitude" width="120" show-overflow-tooltip/>
                        <el-table-column label="纬度" align="center" prop="latitude" width="120" show-overflow-tooltip/>
                        <el-table-column label="结构类型" align="center" prop="jglx" width="180" show-overflow-tooltip>
                            <template #default="scope">
                                <span v-if="scope.row.jglx=='0'">土木/石木结构</span>
                                <span v-if="scope.row.jglx=='1'">砌体结构</span>
                                <span v-if="scope.row.jglx=='2'">木结构</span>
                                <span v-if="scope.row.jglx=='3'">窑洞</span>
                                <span v-if="scope.row.jglx=='4'">钢筋混凝土结构</span>
                                <span v-if="scope.row.jglx=='5'">木（竹）结构</span>
                                <span v-if="scope.row.jglx=='6'">混杂结构</span>
                                <span v-if="scope.row.jglx=='7'">钢结构</span>
                                <span v-if="scope.row.jglx=='8'">其他结构</span>
                                <span v-if="scope.row.jglx=='9'">底部框架-抗震墙砌体结构</span>
                            </template> 
                        </el-table-column>
                        <el-table-column label="建成时间" align="center" prop="buildTime" width="160"/>
                        <el-table-column label="设防烈度" align="center" prop="mqsfld" width="100"/>
                        <el-table-column label="评估结果" align="center" prop="maxDestoryType" width="100">
                            <template #default="scope">
                                <span v-if="scope.row.maxDestoryType=='0'">基本破坏</span>

                                <span v-if="scope.row.maxDestoryType=='1'">轻微破坏</span>
                                <span v-if="scope.row.maxDestoryType=='2'">中等破坏</span>
                                <span v-if="scope.row.maxDestoryType=='3'">严重破坏</span>
                                <span v-if="scope.row.maxDestoryType=='4'">毁坏</span>
                            </template> 
                        </el-table-column>
                    </el-table>
                    <pagination v-show="total1 > 0" :total="total1" v-model:page="formData1.page" v-model:limit="formData1.rows"
                    @pagination="getResultAnalysis" />
                </div>
                <el-divider direction="vertical" border-style="dashed"></el-divider>
                <div class="rightBox">
                    <div>
                        <h2 style="text-align: center;">
                            <p>对于存在严重破坏和毁坏风险</p>
                            <p>的隐患房屋建议</p>
                        </h2>
                        <p>1）优先对重点地区和重点关注的房屋建筑，尽快开展的详细的抗震性能鉴定；</p>
                        <p>2）对于抗震性能鉴定不达标的房屋建筑，尽快制定抗震加固改造方案，分阶段推进加固改造，消减地震灾害风险隐患。</p>
                    </div>
                </div>
            </div>
            <template #footer>
                <div class="dialog-footer">
                    <el-button type="primary" @click="handleExport">房屋数据导出</el-button>
                </div>
            </template>
        </el-dialog>

        <!-- 上传对话框 -->
        <el-dialog v-model="open" width="800px" :title="title" append-to-body>
            <p></p>
            <el-form ref="uploadRef" :model="queryParams" :rules="rules" label-width="150px">
                <el-form-item label="评估内容" prop="sdaAssSeiIntensity">
                    <el-radio-group v-model="queryParams.sdaAssSeiIntensity" @change="changeRadio" :disabled="isViewFile">
                        <el-radio label="房屋抗震能力评估">房屋抗震能力风险初步评估分区图</el-radio>
                        <el-radio label="房屋破坏评估">房屋破坏分布图</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="标题" prop="sdaAssFileTitel">
                    <el-input v-model="queryParams.sdaAssFileTitel" placeholder="请输入标题"
                        :disabled="activeName == 'second'" />
                </el-form-item>
                <el-form-item label="图片" prop="sdaAssFileId">
                    <template v-if="queryParams.dataMessage && queryParams.dataMessage == '成果上传'">
                        <image-upload ref="imageUpload" :limit="limit" v-model="queryParams.attach"
                            :disabled="activeName == 'second'" />
                    </template>
                    <template v-else>
                        <imgUploads ref="imageUpload" :limit="limit" v-model="queryParams.attach" disabled />
                    </template>
                </el-form-item>
                <el-form-item label="数据信息" v-if="isViewFile">
                    <span v-html="queryParams.dataMessage"></span>
                </el-form-item>
            </el-form>
            <template #footer>
                <div class="dialog-footer">
                    <el-button type="primary" @click="handleUpload" v-if="activeName == 'first'">确定</el-button>
                    <el-button @click="cancelUpload">取消</el-button>
                </div>
            </template>
        </el-dialog>
        <!-- 编辑描述 -->
        <el-dialog v-model="openDescribe" width="800px" title="编辑描述">
            <p style="margin-top:20px"></p>
            <el-button type="primary" @click="addDescribe" v-if="describe.length < 4" style="margin-bottom:10px">
                <svg-icon class-name="upload-icon" icon-class="upload" /><span style="margin-left:10px">添加描述</span>
            </el-button>
            <el-form ref="describeRef" :model="describe" :rules="rules" label-width="150px" v-if="describe.length > 0">
                <el-row>
                    <template v-for="(item, index) in describe" :key="index">
                        <el-col :span="22">
                            <el-form-item label="描述" :prop="index + '.describe'" :rules="rules.describe">
                                <el-input v-model="item.describe" type="textarea" maxlength="500" show-word-limit
                                    :autosize="{ minRows: 5, maxRows: 5 }" placeholder="请输入描述" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="2">
                            <el-icon color="red" :size="25" style="margin:20px" @click="remove(index)">
                                <Remove />
                            </el-icon>
                        </el-col>
                    </template>
                </el-row>
            </el-form>
            <template #footer>
                <div class="dialog-footer">
                    <el-button type="primary" @click="handleDescribe">确定</el-button>
                    <el-button @click="openDescribe = false">取消</el-button>
                </div>
            </template>
        </el-dialog>

        <!-- 商会对话框 -->
        <el-dialog v-model="showOption" width="400px" title="震情趋势" :close-on-click-modal="false">
            <p class="worrning">震情趋势已发生变化，请注意！</p>
            <el-radio v-model="radioOption" label="true" style="margin-left:10px">今日不再提醒</el-radio>
            <template #footer>
                <div class="dialog-footer">
                    <el-button type="primary" :disabled="!radioOption" @click="ok">确定</el-button>
                    <el-button @click="cancelOption">取消</el-button>
                </div>
            </template>
        </el-dialog>
    </div>
</template>
<script setup name="house">
import { getImport } from "@/api/business/activities"
import { listHouse, getHouse, uploadHouse, updateHouse, delHouse, firstSubmitDisasterAss, titleCheck, listHouses, updataDescribe, removeDisasterAss, secondSubmitDisasterAss } from "@/api/assess/house";
import { setcookieTimeFun, getCookieFun } from "@/utils/popout"
import { dataMethod } from '@/utils/spanTable.js'
import { isArray } from "@vue/shared";
import imgUploads from '@/components/ImageUploadNew/index.vue'
import reportResult from "@/components/reportResult/index.vue"
import Chart from "../map/house/chart.vue"
import { ElMessage, ElMessageBox } from 'element-plus'
import {resultAnalysis,statistics } from "@/api/assess/map/house"

const { proxy } = getCurrentInstance();
const route = useRoute();
const router = useRouter();
const showIcon = ref(false);
const titleOption = ref();
const loading = ref(false);
const showOption = ref(false);
const open = ref(false);
const radioOption = ref(false);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const id = ref();
const limit = ref(1)
const isViewFile = ref(false);
const sdaRelation = ref();
const activeName = ref('first');
const spanObj = ref();
const openDescribe = ref(false);
const updateIds = ref([]);
const uploadIds = ref([]);
const oldTitle = ref('');
const flagSubmit = ref(true);
const flagMessage = ref([]);
const isEnd = ref(true);
// 文件通知 信息
const fileNoticeName = ref();
const fileNoticeId = ref();
const titleName = (rule, value, callback) => {
    if (!value) {
        callback(new Error('请输入标题'))
    } else if (value && oldTitle.value && title.value == '查看' && oldTitle.value == value) {
        callback()
    } else if (value) {
        const parmas = { sdaRelation: route.query.id, sdaAssFileTitel: value,sdaAssSeiIntensity:queryParams.value.sdaAssSeiIntensity}
        titleCheck(parmas).then(res => {
            if (!res.data) {
                callback()
            } else {
                callback(new Error("该标题已存在，请重新输入"))
            }
        }).catch(_ => {
            callback(new Error(_.message))
        })
    }
}
const data = reactive({
    queryParams: {
        sdaAssFileId: undefined,
        attach: [],
        sdaAssFileTitel: undefined,
        dataMessage: '成果上传',
        sdaAssSeiIntensity: '房屋抗震能力评估',
    },
    dataList: [],
    dataLists: [],
    describe: [],
    rules: {
        sdaAssSeiIntensity: [{ required: true, message: "评估内容不能为空", trigger: "blur" }],
        sdaAssFileId: [{ required: true, message: "图片不能为空", trigger: "blur" }],
        sdaAssFileTitel: [{ required: true, validator: titleName, trigger: "blur" }],
        describe: [{ required: true, message: "描述不能为空", trigger: "blur" }],
    }
})
const { queryParams, dataList, dataLists, rules, describe } = toRefs(data)

const handleClick = (tab, event) => {
    if (tab.props.name == "first") {
        getList();
    } else {
        getLists();
    }
}

function changeRadio(value) {
    queryParams.value = {
        sdaAssFileId: undefined,
        attach: [],
        sdaAssFileTitel: undefined,
        dataMessage: '成果上传',
        sdaAssSeiIntensity: value,
    }
    proxy.resetForm("uploadRef");
}

/** 多选框选中数据 */
function handleSelectionChange(selection) {
    ids.value = selection.map((item) => item.sdaId);
    flagMessage.value = [];
    flagSubmit.value = true;
    if (activeName.value == 'second') {
        selection.forEach((item) => {
            if (!item.describe) {
                flagSubmit.value = false;
                flagMessage.value.push(item.sdaAssSeiIntensity)
            }
        })
        uploadIds.value = [];
        let content = [];
        selection.forEach(item => {
            content.push(item.sdaAssSeiIntensity);
        })
        dataLists.value.forEach(item => {
            content.forEach(i => {
                if (item.sdaAssSeiIntensity == i) {
                    uploadIds.value.push(item.sdaId)
                }
            })
        })
    }
    single.value = selection.length != 1;
    multiple.value = !selection.length;
}

// 合并列
function objectSpanMethod({ row, column, rowIndex, columnIndex }) {
    //判断合并列
    const _row = spanObj.value[column.property] ? spanObj.value[column.property][rowIndex] : 1;
    const _col = _row > 0 ? 1 : 0;
    return {
        rowspan: _row,
        colspan: _col,
    }
}

/** 获取列表操作 */
function getList() {
    sdaRelation.value = route.query.id
    id.value = route.query.id;
    loading.value = true;
    listHouse(id.value).then((response) => {
        dataList.value = response.data ? response.data : [];
        loading.value = false;
    });
}

/** 获取列表操作 */
function getLists() {
    id.value = route.query.id;
    loading.value = true;
    listHouses(id.value).then((response) => {
        dataLists.value = response.data ? response.data : [];
        spanObj.value = dataMethod(dataLists.value, ['sdaAssSeiIntensity']);
        loading.value = false;
    });
}

// 查看房屋评估结果
const loading1 = ref(false);
const numObj= ref({});
const dataList1 = ref([]);
const total1 = ref(0);
const openSuggestion = ref(false);
const selectObj = ref();
function confirmAnalyze(){// 确认
    loading1.value = true;
    statistics({id:selectObj.value.id}).then(res=>{
        numObj.value = res.data;
        getResultAnalysis();
    })
}
function getResultAnalysis(){//评估结果分析
    resultAnalysis({...formData1.value,id:selectObj.value.id}).then(res=>{
        dataList1.value = res.data.rows?res.data.rows:[];
        total1.value = res.data.total;
        loading1.value = false;
        openSuggestion.value = true;
    }).catch(err=>{
        loading1.value = false;
    })
}

// 打开成果上传开关
function openUpload() {
    reset();
    isViewFile.value = false;
    title.value = "上传"
    open.value = true;
}

// 重置上传
function reset() {
    queryParams.value = {
        sdaAssFileId: undefined,
        attach: [],
        sdaAssFileTitel: undefined,
        dataMessage: '成果上传',
        sdaAssSeiIntensity: '房屋抗震能力评估',
    }
    proxy.resetForm("uploadRef");
}

// 成果上传
function handleUpload() {
    console.log(proxy.$refs["imageUpload"].fileList)
    const fileList = JSON.parse(JSON.stringify(proxy.$refs["imageUpload"].fileList));
    const attachIds = [];
    for (var i = 0; i < fileList.length; i++) {
        attachIds.push(fileList[i].attachId)
    }
    queryParams.value.sdaAssFileId = attachIds.join(",");
    proxy.$refs["uploadRef"].validate(valid => {
        if (valid) {
            if (title.value == '上传') {
                upload();
            } else if (title.value == '查看') {
                update();
            }
        }
    });
}
// 修改
function update() {
    updateHouse({ ...queryParams.value, sdaRelation: sdaRelation.value }).then(response => {
        proxy.$modal.msgSuccess("保存成功");
        open.value = false;
        getList();
    }).catch(() => { });
}

// 上传
function upload() {
    console.log('上传最后');
    uploadHouse({ ...queryParams.value, sdaRelation: sdaRelation.value }).then(response => {
        proxy.$modal.msgSuccess("上传成功");
        open.value = false;
        getList();
    }).catch(() => { });
}

function getDetail(id) {
    getHouse(id).then(response => {
        queryParams.value = response.data.disasterAssEntity;
        queryParams.value.sdaAssSeiIntensity = response.data.disasterAssEntity.sdaAssSeiIntensity;
        oldTitle.value = response.data.disasterAssEntity.sdaAssFileTitel;
        queryParams.value.attach = response.data.attach ? [response.data.attach] : [];
        title.value = "查看"
        isViewFile.value = true;
        open.value = true;
    })
}

/** 查看方法*/
function handleDetil(row) {
    isViewFile.value = true;
    title.value = '查看';
    reset();
    getDetail(row.sdaId)
}

// 取消成果上传
function cancelUpload() {
    open.value = false;
}

// 提交最终成果
function handleEndResult(row) {
    firstSubmitDisasterAss(row.sdaId).then(res => {
        getList();
        proxy.$modal.msgSuccess("提交成功");
    })
}
// 移除
function handleRemove(row) {
    removeDisasterAss(row.sdaId).then(res => {
        getLists();
        proxy.$modal.msgSuccess("移除成功");
    })
}
/** 删除按钮操作 */
function handledel(row) {
    const id = row.sdaId;
    proxy.$modal.confirm('是否确认删除' + row.sdaAssSeiIntensity + '的数据项？').then(function () {
        return delHouse(id);
    }).then(() => {
        getList();
        proxy.$modal.msgSuccess("删除成功");
    }).catch(() => { });
}

// 编辑描述
function addOpenDescribe(row) {
    describe.value = [];
    getHouse(row.sdaId).then(response => {
        console.log(response.data.disasterAssEntity);
        if (isArray(response.data.disasterAssEntity.describe)) {
            response.data.disasterAssEntity.describe.forEach(item => {
                describe.value.push({ describe: item });
            });
        } else {
            describe.value = [];
        }

        openDescribe.value = true;
        proxy.resetForm("describeRef");
    })
    updateIds.value = [];
    dataLists.value.forEach(item => {
        if (item.sdaAssSeiIntensity == row.sdaAssSeiIntensity) {
            updateIds.value.push(item.sdaId)
        }
    })
}
// 删除描述
function remove(index) {
    describe.value.splice(index, 1)
}
// 添加
function addDescribe() {
    describe.value.push({ describe: '' });
}
function handleDescribe() {
    if (describe.value.length == 0) {
        const query = { ids: updateIds.value, disasterAss: null };
        updataDescribe(query).then(res => {
            getLists();
            openDescribe.value = false;
            proxy.$modal.msgSuccess("编辑成功");
        })
    } else {
        proxy.$refs["describeRef"].validate(valid => {
            if (valid) {
                describe.value = describe.value.map(item => {
                    return item.describe
                })
                const query = { ids: updateIds.value, disasterAss: describe.value };
                updataDescribe(query).then(res => {
                    getLists();
                    openDescribe.value = false;
                    proxy.$modal.msgSuccess("编辑成功");
                })
            }
        });
    }
}

// 评估
function handleAssess() {
    router.push({
        path: "/assess/houseMap",
        query: {
            id: route.query.id
        }
    })
}

// 下载
function handleDownload(row) {
    if (row.dataMessage == '成果上传') {
        location.href = import.meta.env.VITE_APP_BASE_API + "/attachment/downLoadFile?attachId=" + encodeURIComponent(row.sdaAssFileId);
    } else {
        location.href = import.meta.env.VITE_APP_BASE_API + "/attachment/downLoad?attachId=" + encodeURIComponent(row.sdaAssFileId);
    }
}


// 下载文件
function handleDownloadPort(row) {
    var query = {
        attachId: row.attachId,
        name: row.attachName
    }
    location.href = import.meta.env.VITE_APP_BASE_API + "/attachment/downLoadFile?attachId=" + encodeURIComponent(query.attachId);
};

// 提交
function handleSubmit() {
    if (!flagSubmit.value) {
        proxy.$modal.confirm(flagMessage.value.join(',') + '的描述未添加,是否提交').then(function () {
            return secondSubmitDisasterAss(uploadIds.value);
        }).then(() => {
            getLists();
            proxy.$modal.msgSuccess("提交成功");
        }).catch(() => { });
    } else {
        secondSubmitDisasterAss(uploadIds.value).then(res => {
            getLists();
            proxy.$modal.msgSuccess("提交成功");
        })
    }

}

// 监听单选按钮
watch(showIcon, (val) => {
    console.log(val);
    showOption.value = val;
    if (showOption.value) {
        getTimeSetCookieFun(`houseCookie${route.query.id}`)
    }
})

// 获取日期时间
function getTimeSetCookieFun(name) {
    var day = getCookieFun(name) == '' ? '' : getCookieFun(name);
    if (day == '') {
        // console.log('没有cookie,说明过期或者还没有存')
        showOption.value = true;
    } else {
        var newTime = new Date().getDate();
        if (newTime > day) {
            // console.log('我是新的一天,我要弹窗')
            showOption.value = true;
        } else {
            showOption.value = false;
        }
    }
}
// 取消商会意见
function cancelOption() {
    showOption.value = false;
}
// // 确认不再提示
function ok() {
    var newTime = new Date().getDate();
    setcookieTimeFun(`houseCookie${route.query.id}`, newTime, 1)
    showOption.value = false;
}

function getOpinion() {
    getImport(route.query.id).then(res => {
        titleOption.value = res.data.importantActivity.iaOpinion;
        showIcon.value = Boolean(Number(res.data.importantActivity.iaOpinionStatus));
        fileNoticeName.value = res.data.list[0].attachName;
        fileNoticeId.value = res.data.list[0].attachId;
        isEnd.value = res.data.importantActivity.iaActivityStatus==1;
    })
}
getOpinion();
getList();
</script>
<style lang="scss" scoped>
.container {
    margin: 0px auto;
    height: 100%;
    width: 1200px;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;

    .worrning {
        width: 340px;
        height: 110px;
        color: #3d4a5d;
        font-size: 18px;
        line-height: 26px;
        background: #f5f9fe;
        margin: 30px auto 10px;
        padding: 15px;
    }

    .header {
        padding: 10px 0px;

        .title {
            font-size: 18px;
            font-weight: bold;
        }

        div {
            height: 60px;
            line-height: 60px;
            margin-top: 10px;

            &.icon {
                padding: 0 20px;
                background: #f5f9fe;
            }
        }
    }

    .tabsBox {
        padding: 0;
        margin: 0;
        position: relative;
    }

    .button {
        position: absolute;
        top: 5px;
        left: 205px;
        z-index: 200;
    }

    .two {
        :deep(.el-table) td.el-table__cell {
            border-bottom: 1px solid #ebeef5 !important;
            border-right: 1px solid #ebeef5 !important;
        }
    }
}

.ulList {
    li {
        line-height: 30px;
    }

    li::marker {
        color: #F56C6C;
        font-size: 25px;
    }
}

.suggesBox{
    height: 865px;
    display: flex;
    .el-divider--vertical {
        display: inline-block;
        height: 100%;
        margin: 0 8px;
    }
    .leftBox{
       flex: 1; 
    }
    .rightBox{
        width:300px;
        min-height: 500px;
        display: flex;
        align-items: center;
        justify-content: center;
        div{
            >p{
                font-size: 16px;
                text-indent: 2em;
                padding:0 20px;
                line-height: 50px;
            }
        }
    }
}
</style>
  